package com.lankystar.todolist.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.lankystar.common.Page;
import com.lankystar.todolist.dao.AccountMapper;
import com.lankystar.todolist.dao.TaskMapper;
import com.lankystar.todolist.model.Account;
import com.lankystar.todolist.model.Role;
import com.lankystar.todolist.model.Task;
import com.lankystar.todolist.service.IDemoService;

@Component
public class DemoServiceImpl implements IDemoService {
	@Autowired
	private TaskMapper taskDao;
	@Autowired
	private AccountMapper accountDao;

	@Override
	public Page<Task> getTasks(Page<Task> page) {
		// List<Task> datas = taskDao.findAllByPage(1, 2, page);
		// page.setDatas(datas);
		return null;
	}

	@Override
	public void editAccount() {
		Account account = new Account();
		account.setNickname("测试事物！");
		account.setPhone("123456");
		account.setQq("123456789012");
		account.setUsername("abcasdqqqe");
		account.setUserpwd("ceshiecsdada");
		account.setRole(Role.LEADER.toString());
		accountDao.insert(account);
		int i = 1 / 0;
		System.out.println(i);
	}
	@Override
	public List<Account> findAccounts() {
		return accountDao.selectAccounts();
	}

}
